# Attach these packages so their functions don't need to be qualified: http://r-pkgs.had.co.nz/namespace.html#search-path
library(magrittr) # enables piping : %>%
library(ggplot2)
# Verify these packages are available on the machine, but their functions need to be qualified: http://r-pkgs.had.co.nz/namespace.html#search-path
requireNamespace("ggplot2") # graphing
requireNamespace("readr") # data input
requireNamespace("tidyr") # data manipulation
requireNamespace("dplyr") # Avoid attaching dplyr, b/c its function names conflict with a lot of packages (esp base, stats, and plyr).
requireNamespace("testit") # For asserting conditions meet expected patterns.
requireNamespace("corrplot") # For asserting conditions meet expected patterns.
# requireNamespace("car") # For it's `recode()` function.
# Call `base::source()` on any repo file that defines functions needed below. Ideally, no real operations are performed.
source("./scripts/common-functions.R") # used in multiple reports
source("./scripts/graph-presets.R") # fonts, colors, themes
#Put code in here. It doesn't call a chunk in the codebehind file.
# the production of the dto object is now complete
# we verify its structure and content:
dto <- readRDS("./data/unshared/derived/dto.rds")
names(dto)
[1] "unitData" "metaData" "analytic"
# 1st element - dto[["unitData"]] - unit(person) level data; all original variables
# 2nd element - dto[["metaData"]] - meta data, info about variables
meta <- dto[["metaData"]]
# 3rd element - dto[["analytic"]] - small, groomed data to be used for analysis
ds <- dto[["analytic"]]
| Variable name | Label |
|---|---|
| id | person identifier |
| pregnant | Are you pregnant? |
| marital | What is your marital status? |
| education | How far did you go in school? |
| weeks_pregnant | Duration of pregnancy (weeks) |
| haskids | Do you have children? |
| Proposed Factor | Number of items |
|---|---|
| embarrassment | 6 |
| pain | 5 |
| meds | 5 |
| delivery.mode | 6 |
| safe.baby | 6 |
| safe.mom | 5 |
| body.change | 5 |
| sex.function | 4 |
| interventions | 7 |
embarrassment| Factor | Code name | Short Name | Label |
|---|---|---|---|
| embarrassment | foc_01 | rude | 1 - Losing emotional control in front of other people (being rude, yelling) during labour/birth? |
| embarrassment | foc_02 | urine | 2 - Having other people see me urinate during labour/birth? |
| embarrassment | foc_03 | bowel | 3 - Other people seeing me have a bowel movement during labour/birth? |
| embarrassment | foc_04 | naked | 4 - Other people seeing me naked during labour/birth? |
| embarrassment | foc_05 | weak | 5 - Not living up to expectations to be strong? |
| embarrassment | foc_06 | watched | 6 - Being watched by strangers during labour/birth? |
pain| Factor | Code name | Short Name | Label |
|---|---|---|---|
| pain | foc_07 | contractions | 7 - Experiencing pain during contractions? |
| pain | foc_08 | vaginal | 8 - Experiencing pain during a vaginal birth? |
| pain | foc_09 | cesarean | 9 - Experiencing pain during a cesarean birth? |
| pain | foc_10 | labour | 10 - Experiencing pain during labour? |
| pain | foc_11 | pushing | 11 - Experiencing pain while pushing the baby out? |
meds| Factor | Code name | Short Name | Label |
|---|---|---|---|
| meds | foc_12 | no.meds | 12 - Not getting the pain medication I need? |
| meds | foc_13 | no.epidural | 13 - Not being able to have an epidural during labour if I want/need one? |
| meds | foc_14 | unwanted | 14 - Receiving unwanted pain medication during labour/birth? |
| meds | foc_15 | pres.pain | 15 - Feeling pressure to receive pain medication during labour/birth even though I may not want to? |
| meds | foc_16 | pres.natur | 16 - Feeling pressure from others to have a natural (unmedicated) childbirth, even though this is not really what I want? |
delivery.mode| Factor | Code name | Short Name | Label |
|---|---|---|---|
| delivery.mode | foc_17 | no.choice | 17 - Not being able to have the kind of birth I want (i.e., either vaginal or cesarean)? |
| delivery.mode | foc_18 | no.cesarean | 18 - Not being able to have a cesarean birth, even though this is what I would prefer? |
| delivery.mode | foc_19 | no.vaginal | 19 - Not being able to have a vaginal birth, even though this is what I would prefer? |
| delivery.mode | foc_20 | vaginal? | 20 - Having a vaginal birth? |
| delivery.mode | foc_21 | ceasarean? | 21 - Having a cesarean birth? |
| delivery.mode | foc_49 | vomit | 49 - Vomiting during labour/birth? |
safe.baby| Factor | Code name | Short Name | Label |
|---|---|---|---|
| safe.baby | foc_22 | harmed | 22 - The baby being harmed during labour/birth? |
| safe.baby | foc_23 | die | 23 - The baby dying during labour/birth? |
| safe.baby | foc_24 | handicapped | 24 - The baby being damaged/handicapped as a consequence of labour/birth? |
| safe.baby | foc_25 | illness | 25 - The baby contracting an illness during labour/birth (e.g., Herpes, HIV)? |
| safe.baby | foc_26 | suffocate | 26 - The baby suffocating during labour/birth? |
| safe.baby | foc_27 | hurt.in.labor | 27 - The baby being hurt by a medical intervention that takes place during labour/birth (e.g., vacuum, anesthetics)? |
safe.mom| Factor | Code name | Short Name | Label |
|---|---|---|---|
| safe.mom | foc_28 | bleed | 28 - Bleeding too much during labour/birth? |
| safe.mom | foc_29 | incompetent | 29 - Being harmed because of incompetent medical care? |
| safe.mom | foc_30 | die | 30 - Dying during labour/birth? |
| safe.mom | foc_31 | tear.vaginal | 31 - Vaginal tearing during labour/birth? |
| safe.mom | foc_32 | tear.rectal | 32 - Rectal tearing/damage as a consequence of labour/birth? |
body.change| Factor | Code name | Short Name | Label |
|---|---|---|---|
| body.change | foc_33 | scars.vaginal | 33 - Being left with scars from a vaginal birth? |
| body.change | foc_34 | scars.cesarean | 34 - Being left with scars from a cesarean birth? |
| body.change | foc_35 | stretch.vaginal | 35 - Stretching of my vagina from giving birth vaginally? |
| body.change | foc_36 | less.attractive | 36 - My body looking less attractive following the birth? |
| body.change | foc_37 | less.attr.vagina | 37 - My vagina looking less attractive following a vaginal childbirth? |
sex.function| Factor | Code name | Short Name | Label |
|---|---|---|---|
| sex.function | foc_38 | enjoy | 38 - Enjoying sexual intercourse less because of stretching from a vaginal birth? |
| sex.function | foc_39 | partner | 39 - My partner enjoying sexual intercourse less because of stretching of my vagina from having a vaginal birth? |
| sex.function | foc_47 | sex.discomfort | 47 - Enjoying sexual intercourse less because of pain or discomfort from the birth? |
| sex.function | foc_48 | epidural | 48 - Being administered an epidural? |
interventions| Factor | Code name | Short Name | Label |
|---|---|---|---|
| interventions | foc_40 | episiotomy | 40 - Having an episiotomy? |
| interventions | foc_41 | vacuum | 41 - Requiring vacuum or forceps? |
| interventions | foc_42 | injection | 42 - Being administered injections? |
| interventions | foc_43 | catheter | 43 - Having a catheter inserted (a tube inserted into the urethra to collect urine)? |
| interventions | foc_44 | gen.anesthetic | 44 - Having general anesthetic? |
| interventions | foc_45 | no.healing | 45 - Having scars or wounds that do not heal properly? |
| interventions | foc_46 | stitches | 46 - Needing to have stitches after the birth? |
| Code name | Short Name | Label |
|---|---|---|
| itf_1 | relations-spouse | Interference 1 - My relationship with my partner/spouse. |
| itf_2 | relations-family | Interference 2 - My relationships with family members |
| itf_3 | relations-other | Interference 3 - Other relationships in my life |
| itf_4 | relations-parents | Interference 4 - My relationships with my prenatal caregivers |
| itf_5 | work-life | Interference 5 - My work life |
| itf_6 | leisure | Interference 6 - My leisure activities |
| itf_7 | baby-ready | Interference 7 - Getting ready for the new baby |
Correlation of items in the proposed factor:
NULL
1 - Losing emotional control in front of other people (being rude, yelling) during labour/birth?
Mean: 1.84
SD: 1.06
Missing: 0
2 - Having other people see me urinate during labour/birth?
Mean: 1.97
SD: 1.15
Missing: 0
3 - Other people seeing me have a bowel movement during labour/birth?
Mean: 2.55
SD: 1.36
Missing: 0
4 - Other people seeing me naked during labour/birth?
Mean: 2.03
SD: 1.18
Missing: 0
5 - Not living up to expectations to be strong?
Mean: 2.25
SD: 1.29
Missing: 0
6 - Being watched by strangers during labour/birth?
Mean: 2.34
SD: 1.29
Missing: 0
Correlation of items in the proposed factor:
NULL
7 - Experiencing pain during contractions?
Mean: 2.73
SD: 1.21
Missing: 0
8 - Experiencing pain during a vaginal birth?
Mean: 2.89
SD: 1.27
Missing: 0
9 - Experiencing pain during a cesarean birth?
Mean: 2.82
SD: 1.48
Missing: 0
10 - Experiencing pain during labour?
Mean: 2.81
SD: 1.23
Missing: 0
11 - Experiencing pain while pushing the baby out?
Mean: 2.89
SD: 1.27
Missing: 0
Correlation of items in the proposed factor:
NULL
12 - Not getting the pain medication I need?
Mean: 2.14
SD: 1.3
Missing: 0
13 - Not being able to have an epidural during labour if I want/need one?
Mean: 2.03
SD: 1.32
Missing: 0
14 - Receiving unwanted pain medication during labour/birth?
Mean: 2.42
SD: 1.4
Missing: 0
15 - Feeling pressure to receive pain medication during labour/birth even though I may not want to?
Mean: 2.2
SD: 1.35
Missing: 0
16 - Feeling pressure from others to have a natural (unmedicated) childbirth, even though this is not really what I want?
Mean: 1.48
SD: 0.97
Missing: 0
Correlation of items in the proposed factor:
NULL
17 - Not being able to have the kind of birth I want (i.e., either vaginal or cesarean)?
Mean: 3.1
SD: 1.39
Missing: 0
18 - Not being able to have a cesarean birth, even though this is what I would prefer?
Mean: 1.23
SD: 0.72
Missing: 0
19 - Not being able to have a vaginal birth, even though this is what I would prefer?
Mean: 3.24
SD: 1.44
Missing: 0
20 - Having a vaginal birth?
Mean: 1.92
SD: 1.16
Missing: 0
21 - Having a cesarean birth?
Mean: 3.54
SD: 1.38
Missing: 0
49 - Vomiting during labour/birth?
Mean: 1.81
SD: 1.11
Missing: 0
Correlation of items in the proposed factor:
NULL
22 - The baby being harmed during labour/birth?
Mean: 3.17
SD: 1.42
Missing: 0
23 - The baby dying during labour/birth?
Mean: 3.03
SD: 1.53
Missing: 0
24 - The baby being damaged/handicapped as a consequence of labour/birth?
Mean: 3.13
SD: 1.46
Missing: 0
25 - The baby contracting an illness during labour/birth (e.g., Herpes, HIV)?
Mean: 1.9
SD: 1.41
Missing: 0
26 - The baby suffocating during labour/birth?
Mean: 2.88
SD: 1.56
Missing: 0
27 - The baby being hurt by a medical intervention that takes place during labour/birth (e.g., vacuum, anesthetics)?
Mean: 3.44
SD: 1.38
Missing: 0
Correlation of items in the proposed factor:
NULL
28 - Bleeding too much during labour/birth?
Mean: 2.56
SD: 1.2
Missing: 0
29 - Being harmed because of incompetent medical care?
Mean: 2.96
SD: 1.37
Missing: 0
30 - Dying during labour/birth?
Mean: 2.14
SD: 1.29
Missing: 0
31 - Vaginal tearing during labour/birth?
Mean: 2.67
SD: 1.31
Missing: 0
32 - Rectal tearing/damage as a consequence of labour/birth?
Mean: 2.95
SD: 1.34
Missing: 0
Correlation of items in the proposed factor:
NULL
33 - Being left with scars from a vaginal birth?
Mean: 2.04
SD: 1.19
Missing: 0
34 - Being left with scars from a cesarean birth?
Mean: 2.4
SD: 1.41
Missing: 0
35 - Stretching of my vagina from giving birth vaginally?
Mean: 2.16
SD: 1.26
Missing: 0
36 - My body looking less attractive following the birth?
Mean: 2.33
SD: 1.26
Missing: 0
37 - My vagina looking less attractive following a vaginal childbirth?
Mean: 2.02
SD: 1.26
Missing: 0
Correlation of items in the proposed factor:
NULL
38 - Enjoying sexual intercourse less because of stretching from a vaginal birth?
Mean: 2.14
SD: 1.25
Missing: 0
39 - My partner enjoying sexual intercourse less because of stretching of my vagina from having a vaginal birth?
Mean: 2.25
SD: 1.32
Missing: 0
47 - Enjoying sexual intercourse less because of pain or discomfort from the birth?
Mean: 2.28
SD: 1.23
Missing: 0
48 - Being administered an epidural?
Mean: 3.06
SD: 1.37
Missing: 0
Correlation of items in the proposed factor:
NULL
40 - Having an episiotomy?
Mean: 3.22
SD: 1.35
Missing: 0
41 - Requiring vacuum or forceps?
Mean: 3.06
SD: 1.34
Missing: 0
42 - Being administered injections?
Mean: 2.28
SD: 1.29
Missing: 0
43 - Having a catheter inserted (a tube inserted into the urethra to collect urine)?
Mean: 2.68
SD: 1.39
Missing: 0
44 - Having general anesthetic?
Mean: 2.86
SD: 1.45
Missing: 0
45 - Having scars or wounds that do not heal properly?
Mean: 2.71
SD: 1.23
Missing: 0
46 - Needing to have stitches after the birth?
Mean: 2.55
SD: 1.28
Missing: 0
Correlation of items in the proposed factor:
NULL
40 - Having an episiotomy?
Mean: 3.22
SD: 1.35
Missing: 0
41 - Requiring vacuum or forceps?
Mean: 3.06
SD: 1.34
Missing: 0
42 - Being administered injections?
Mean: 2.28
SD: 1.29
Missing: 0
43 - Having a catheter inserted (a tube inserted into the urethra to collect urine)?
Mean: 2.68
SD: 1.39
Missing: 0
44 - Having general anesthetic?
Mean: 2.86
SD: 1.45
Missing: 0
45 - Having scars or wounds that do not heal properly?
Mean: 2.71
SD: 1.23
Missing: 0
46 - Needing to have stitches after the birth?
Mean: 2.55
SD: 1.28
Missing: 0
# prepare variables as factors
foc_levels <- c(0,1,2,3,4)
foc_labels <- c("Not at all",
"Slightly",
"Moderately",
"Very",
"Extremely")
# (varlist <- c(paste0("foc_0",1:9),paste0("foc_",10:49)))
#
#
# for( i in varlist){
# ds[,i] <- as.numeric(ds[,i])-1
# ds[,i] <- factor(ds[,i], levels = foc_levels, labels = foc_labels)
# }